package com.example.tests;

import com.example.GeneralMetods;
import com.example.SortedListOf;
import com.example.User;
import com.example.pages.UserManagementPage;
import org.junit.*;

import static org.junit.Assert.*;

public class AddUser extends GeneralMetods {

    @Test
    public void testAddUser() throws Exception {
        UserManagementPage usersPage = goToMainPage()
                .loginAs("admin", "admin")
                .goToUserManagementPage();
        SortedListOf<User> oldUsersList = usersPage.getUsers();
        User user = new User()
                .withName("ndv")
                .withEmail("ndv.code@gmail.com")
                .withPassword("123456");

        usersPage.createUser(user);
        SortedListOf<User> newUsersList = usersPage.getUsers();

        assertEquals(oldUsersList.withAdded(user), newUsersList);
        usersPage.logout();

    }



}
